package com.wdcg.model.dao;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName= "Bonus")
public class Bonus {
	public static final String BONUS_ID_COLUMN="bonusID";
	
	@DatabaseField(id=true, columnName=BONUS_ID_COLUMN)
	private int id;
	
	@DatabaseField(columnName="longitude")
	private Double longitude;

	@DatabaseField(columnName="latitude")
	private Double latitude;
	
	@DatabaseField(columnName="imgTitle")
	private String imgTitle;
	
	@DatabaseField(columnName="unlocksCount", defaultValue="0")
	private Integer unlocksCount;

	@DatabaseField(canBeNull = true,foreign=true, foreignAutoRefresh = true, columnName=BonusType.BONUS_TYPE_ID_COLUMN)
	BonusType bonusType;
	
	@ForeignCollectionField(eager=false)
	private ForeignCollection<BonusDescription> bonusDescriptions;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public String getImgTitle() {
		return imgTitle;
	}

	public void setImgTitle(String imgTitle) {
		this.imgTitle = imgTitle;
	}

	public Integer getUnlocksCount() {
		return unlocksCount;
	}

	public void setUnlocksCount(Integer unlocksCount) {
		this.unlocksCount = unlocksCount;
	}

	public BonusType getBonusType() {
		return bonusType;
	}

	public void setBonusType(BonusType bonusType) {
		this.bonusType = bonusType;
	}

	public ForeignCollection<BonusDescription> getBonusDescriptions() {
		return bonusDescriptions;
	}

	public void setBonusDescriptions(
			ForeignCollection<BonusDescription> bonusDescriptions) {
		this.bonusDescriptions = bonusDescriptions;
	}

	@Override
	public String toString() {
		return "Bonus [id=" + id + ", longitude=" + longitude + ", latitude="
				+ latitude + ", imgTitle=" + imgTitle + ", unlocksCount="
				+ unlocksCount + ", bonusType=" + bonusType
				+ ", bonusDescriptions=" + bonusDescriptions + "]";
	}

}
